package com.example.spring01.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * 描述该类
 *
 * @author <a href="920786312@qq.com">周飞</a>
 * @class: Bean1
 * @date 2021/10/21 10:36
 * @Verson 1.0 -2021/10/21 10:36
 * @see
 */
public class BeanHandler implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("---------所有bean 初始化方法前,执行动作---------");
        System.out.println("beanName:"+beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("bean:"+bean);
        System.out.println("---------所有bean 初始化方法后,执行动作---------");

        System.out.println();
        return bean;
    }
}